package org.javabb.action.infra;

import java.util.List;

import org.javabb.exception.FieldException;
import org.javabb.infra.FeedConstantLists;


/*
 * Copyright 2004 JavaFree.org
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

/**
 * $Id: BaseAction.java,v 1.1.4.1.6.7 2008/05/31 00:20:23 daltoncamargo Exp $
 * @author Dalton Camargo - <a href="mailto:dalton@javabb.org">dalton@javabb.org </a> <br>
 * @author Ronald Tetsuo Miura
 * @author Lucas Teixeira - <a href="mailto:lucas@javabb.org">lucas@javabb.org </a> <br>
 */
public class BaseAction extends ActionSuper {

	private static final long serialVersionUID = 1L;

	/** */
    protected Long _categoryId;

    protected String _seoUrl;
    
    /** */
    protected Long _forumId;

    /** */
    protected Long _topicId;

    /** */
    protected Long _postId;

    /** */
    protected Long _userId;

    /** */
    protected Long _smileId;

    /** */
    protected Long _badWordId;
    
    
    private String subject;
    private String message;
    protected int watchTopic;
    private Integer checkSign;
    protected List msgErrors;
    
    protected void checkMessage() throws Exception{
    	if(message != null){
    		if(message.replaceAll(" ", "").length() < 2){
    			throw new FieldException(getText("topic.message.required"));
    		}
    	} else {
    		throw new FieldException(getText("topic.message.required"));
    	}
    }
    
    protected void checkSubject() throws Exception{
    	if(subject != null){
    		if(subject.replaceAll(" ", "").length() < 2){
    			throw new FieldException(getText("topic.subject.required"));
    		}
    	} else {
    		throw new FieldException(getText("topic.subject.required"));
    	}
    }    
    
    
    /**
     * @param id the new badWordId value
     */
    public final void setB(Long id) {
        this._badWordId = id;
    }

    /**
     * @param id the new categoryId value
     */
    public final void setC(Long id) {
        this._categoryId = id;
    }

	public void setSeoUrl(String _seoUrl) {
		this._seoUrl = _seoUrl;
	}

	/**
     * @param id the new smileId value
     */
    public final void setS(Long id) {
        this._smileId = id;
    }

    /**
     * @param id the new forumId value
     */
    public final void setF(Long id) {
        this._forumId = id;
    }

    /**
     * @param id the new postId value
     */
    public final void setP(Long id) {
        this._postId = id;
    }

    /**
     * @param id the new topicId value
     */
    public final void setT(Long id) {
        this._topicId = id;
    }

    /**
     * @param id the new userId value
     */
    public final void setU(Long id) {
        this._userId = id;
    }

    /**
     * @return id
     */
    public Long getBadWordId() {
        return _badWordId;
    }

    /**
     * @return id
     */
    public Long getCategoryId() {
        return _categoryId;
    }

    /**
     * @return id
     */
    public Long getSmileId() {
        return _smileId;
    }

    /**
     * @return id
     */
    public Long getForumId() {
        return _forumId;
    }

    /**
     * @return id
     */
    public Long getPostId() {
        return _postId;
    }

    /**
     * @return id
     */
    public Long getTopicId() {
        return _topicId;
    }

    /**
     * @return id
     */
    public Long getUserId() {
        return _userId;
    }

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}
	
	public Integer getCheckSign() {
		return checkSign;
	}

	public void setCheckSign(Integer checkSign) {
		this.checkSign = checkSign;
	}

	public List getMsgErrors() {
		return msgErrors;
	}

	public void setMsgErrors(List msgErrors) {
		this.msgErrors = msgErrors;
	}

	public int getWatchTopic() {
		return watchTopic;
	}

	public void setWatchTopic(int watchTopic) {
		this.watchTopic = watchTopic;
	}
	
	public List getFeedEmpregos(){
		return FeedConstantLists.feedEmpregos;
	}
	
	public List getFeedInfoBlogs(){
		return FeedConstantLists.feedInfoblogs;
	}
	
	
	
}